<template>
    <div>
        <el-header style="text-align: right; font-size: 15px">

            <span id="patient_id">
                patient_id
            </span>
        </el-header>
        <el-table
                :data="tableData"
                border
                style="width: 100%">
            <el-table-column
                    fixed
                    prop="c_id"
                    label="科目号"
                    width="130%">
            </el-table-column>
            <el-table-column
                    fixed
                    prop="c_name"
                    label="科目名称"
                    width="130%">
            </el-table-column>

            <el-table-column
                    fixed
                    prop="score"
                    label="分数"
                    width="250%">
            </el-table-column>
            <el-table-column
                    fixed
                    prop="c_credit"
                    label="学分"
                    width="130%">
            </el-table-column>

            <el-table-column
                    fixed
                    label="操作"
                    width="102">
                <template slot-scope="scope">
                    <el-button @click="modify(scope.row)" type="text" size="small">修改/登记</el-button>
                </template>
            </el-table-column>
            </el-table>
            <el-form>
                <el-form-item>
                    <el-button  type="primary" @click="backForm('formLabelAlign')">返 回</el-button>
                </el-form-item>
        </el-form>
    </div>
</template>

<script>
    export default {
        methods: {
            modify(row){
                this.$router.push({
                    path: '/Page12',
                    query:{
                        s_id:row.s_id,
                        s_name:row.s_name,
                        c_id:row.c_id,
                        c_name:row.c_name,
                        score:row.score,
                        c_credit:row.c_credit
                    }
                })
            },
            backForm(formName) {
                this.$router.push('/Page7')
            }


        },
        created() {
            const _this = this
            axios.get('http://localhost:8181/score/findById/'+this.$route.query.id).then(function (resp) {
                _this.tableData = resp.data,
                document.getElementById("patient_id").innerHTML = resp.data[0].s_id+'，'+resp.data[0].s_name+'的成绩单'
            })
        },
        data() {
            return {
                total: null,
                tableData: null
                }

        }
    }
</script>